package grid;

public class Distribution {

	private Distribution() {
	}
	
	/**
	 * @param gridSize
	 * @return
	 */
	public static double[] distribute01(int gridSize){
		if (gridSize <2) {
			throw new NullPointerException("gridSize impossible");
		}
		final double[] coords = new double[gridSize];
		coords[0] =0;
		coords[gridSize-1] =1;
		for (int i = 1; i < gridSize-1; i++) {
			coords[i] = i*1.0/(gridSize-1);
		}
		return  coords;
	}
	
	
	public static double[] distribute(int gridSize, int imageSize) {
		if (gridSize <2) {
			throw new NullPointerException("gridSize impossible");
		}
		final double[] coords = new double[gridSize];
		coords[0] =0;
		coords[gridSize-1] =imageSize;
		for (int i = 1; i < gridSize-1; i++) {
			coords[i] = i*(1.0/(gridSize-1))*imageSize;
		}
		return  coords;
	}

}
